package com.fwmagic.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @description:
 * @author: fangwei
 * @date: 2022/4/13
 **/
@RestController
public class OrderNacosController {

    @Value("${server-url.nacos-user-service}")
    private String serverURL;

    @Value("${config.info}")
    private String configInfo;

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/consumer/payment/nacos/{id}")
    public String paymentInfo(@PathVariable("id") Integer id) {
        return configInfo + "\t" + restTemplate.getForObject(serverURL + "/payment/nacos/" + id, String.class);

    }
}
